<html>
   <head>
      <script type = "text/javascript" src = "https://d3js.org/d3.v4.min.js"></script>
   </head>
   <body>
      <p></p>
      <div></div>
      <h1></h1>
      <script>
         d3.select("p")
         .datum(50)
         .text(function(d) { 
            return "Used existing paragraph element and the data " + d + " is assigned."; 
         });
        //  设置数据后可以添加新的元素
         d3.select("div")
         .datum(100)
         .append("p")
         .text(function(d) { 
            return "Created new paragraph element and the data " + d + " is assigned."; 
         });
        //  可以设置样式
         d3.select("h1").datum(10000).text(function(item){return `这里有${item}块钱`}).attr("style","color:red")
      </script>
   </body>
</html>